// 导入仓库
import store from './store/index'
// 导入actionCreator
import {addGoods} from './store/slice/goodsSlice'
import {addCart} from './store/slice/cartSlice'
// 监听
store.subscribe(() => {
    console.log(store.getState());
})


// 添加商品
let goodsAction = addGoods({
    gname: '华为手机',
    price: 5980
})
console.log('goodsAction: ', goodsAction);
store.dispatch(goodsAction)
// 添加商品
store.dispatch(addGoods({
    gname: '小米手机',
    price: 3990
}))


// 添加购物车
let goods1 = store.getState().goods.goodsList[1]
store.dispatch(addCart(goods1))

let goods2 = store.getState().goods.goodsList[0]
store.dispatch(addCart(goods2))
store.dispatch(addCart(goods2))



